public class CRGatePhoton : PhotonTransformView
{
	public CRGate crGate;

	public override void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
	{
		if (stream.isWriting)
		{
			stream.SendNext(crGate.health);
			stream.SendNext(crGate.maxHealth);
			return;
		}
		crGate.health = (int)stream.ReceiveNext();
		int maxHealth = crGate.maxHealth;
		crGate.maxHealth = (int)stream.ReceiveNext();
		if (maxHealth != crGate.maxHealth)
		{
			CopsAndRobbersInterface.instance.ResetUI(CopsAndRobbersController.instance.gates);
		}
		if (crGate.health <= 0 && !crGate.isDead)
		{
			crGate.Kill();
		}
	}
}
